local fenzhou = fk.CreateSkill{
    name = "steam__fenzhou",
    dynamic_desc = function(self, player)
        if player:getMark("steam__fenzhou") == 1 then
            return "steam__fenzhou_hasbeishui"
        else
            return "steam__fenzhou_nobeishui"
        end
    end,
}

-- 添加luan函数用于管理表的大小
local function luan(t, value)
    if not t then t = {} end
    table.insert(t, value)
    if #t > 2 then
        table.remove(t, 1)
    end
    return t
end

Fk:loadTranslationTable{
    ["steam__fenzhou"] = "焚舟",
    [":steam__fenzhou"] = "出牌阶段，若你上两次执行的选项源于同一个其他技能，则你可选择一项：1.视为使用【火攻】；2.视为使用不计次数的火【杀】。",
    ["#steam__fenzhou"] = "焚舟:你可选择一项：1.视为使用【火攻】；2.视为使用不计次数的火【杀】。",
    ["@fenzhou_record"] = "焚舟",
    ["#steam__fenzhou-choice"] = "焚舟：请选择一项",
    ["fenzhou_huogong"] = "视为使用【火攻】",
    ["fenzhou_huosha"] = "视为使用不计次数的火【杀】",
    [":steam__fenzhou_hasbeishui"] = "出牌阶段，若你上两次执行的选项源于同一个其他技能，则你可选择一项：1.视为使用【火攻】；2.视为使用不计次数的火【杀】。背水：将此词条移至“孟明视”的一个相邻技能描述中。",
    [":steam__fenzhou_nobeishui"] = "出牌阶段，若你上两次执行的选项源于同一个其他技能，则你可选择一项：1.视为使用【火攻】；2.视为使用不计次数的火【杀】。",
}



fenzhou:addEffect("active", {
    prompt = "#steam__fenzhou",
    anim_type = "support",
    card_num = 0,
    target_num = 0,
    can_use = function (self, player)
      local record=player:getTableMark("@fenzhou_record")
      if #record==2 then
        return record[1]==record[2]
      end
      return false
    end,
    on_use = function (self, room, effect)
      local player= effect.from
      local choices={"fenzhou_huogong","fenzhou_huosha"}
      if player:getMark(fenzhou.name)==1 then
        table.insert(choices,"mengmingshi_beishui")
      end
      local choice=room:askForChoice(player,choices,self.name,"#steam__fenzhou-choice")

      local record=player:getTableMark("@fenzhou_record")
      record=luan(record,"steam__fenzhou")
      room:setPlayerMark(player,"@fenzhou_record",record)
      --背水
      if choice == "mengmingshi_beishui" then
        room:setPlayerMark(player,"steam__fenzhou",0)
        room:setPlayerMark(player,"steam__qiedai",1)
      end

      if choice~="fenzhou_huogong" then
        room:askToUseVirtualCard(player, {
            name = "fire__slash",skill_name = fenzhou.name,
            },self.name)
      end
      if choice~="fenzhou_huosha" then
        room:askToUseVirtualCard(player, {
            name = "fire_attack",skill_name = fenzhou.name,
            },self.name)
      end
    end,
  })

return fenzhou 